<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">
        <div><?php include "../public_flow/flow_show_info.php";?></div>
        <div class="tongbox tongbox5">
            <div class="tuo"><div class="tit">项目名称</div><div class="con" id="tong_enginname"></div></div>
            <div class="tuo"><div class="tit">合同类型</div><div class="con" id="tong_shihetype_name"></div></div>
            <div class="tuo"><div class="tit">发包方(甲方)</div><div class="con" id="tong_faer"></div></div>
            <div class="tuo"><div class="tit">承包方(乙方)</div><div class="con" id="tong_chenger_name"></div></div>
            <div class="tuo"><div class="tit">合同金额含税(元)</div><div class="con" id="tong_money"></div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">项目信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">项目名称</td><td class="tv colorlan" id="enginid_name" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">收入合同信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">合同名称</td><td id="name" class="tv"></td><td class="tt">合同编号</td><td id="number" class="tv"></td></tr>
                <tr><td class="tt">合同类型</td><td id="shihetype_name" class="tv"></td><td class="tt">合同年份</td><td id="year" class="tv"></td></tr>
                <tr><td class="tt">(发包方)甲方</td><td id="faer" class="tv"></td><td class="tt">承包方(乙方)</td><td id="chenger_name" class="tv"></td></tr>
                <tr><td class="tt">合同金额含税(元)</td><td id="money" class="tv"></td><td class="tt">税率(%)</td><td id="rate" class="tv"></td></tr>
                <tr><td class="tt">合同金额不含税(元)</td><td id="noshuifee" class="tv"></td><td class="tt">合同工期(天)</td><td id="duration" class="tv"></td></tr>
                <tr><td class="tt">合同开工日期</td><td id="startdt" class="tv"></td><td class="tt">合同竣工日期</td><td id="enddt" class="tv"></td></tr>
                <tr><td class="tt">质保金比例(%)</td><td id="zhirate" class="tv"></td><td class="tt">质保金金额(元)</td><td id="zhifee" class="tv"></td></tr>
                <tr><td class="tt">质保期(天)</td><td id="zhinum" class="tv"></td><td class="tt">质保金到期日期</td><td id="zhidt" class="tv"></td></tr>
                <tr><td class="tt">合同状态</td><td id="state" class="tv"></td><td class="tt">签订日期</td><td id="qiandt" class="tv"></td></tr>
                <tr><td class="tt">合同份数</td><td id="henum" class="tv"></td><td class="tt">是否公司业绩</td><td id="isyeji" class="tv"></td></tr>
                <tr><td class="tt">主要条款</td><td class="tv" id="clause" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">补充合同</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>

    <div class="showrrboxtext">
        <div class="table-box tablenes">
            <div class="title">增补/签证</div>
            <div class="tuo"><div class="tit">合同金额含税(元)</div><div class="con" id="right_money">0</div></div>
            <div class="tuo"><div class="tit">补充合同金额含税(元)</div><div class="con" id="right_bumoney">0</div></div>
            <div class="tuo"><div class="tit">收入合同金额含补充(元)</div><div class="con" id="right_shimoney">0</div></div>
            <div class="tuo"><div class="tit">项目签证金额含税(元)</div><div class="con" id="right_visamoney">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">合同结算</div>
            <div class="tuo"><div class="tit">产值填报金额(元)</div><div class="con" id="right_chanmoney">0</div></div>
            <div class="tuo"><div class="tit">收入合同结算金额(元)</div><div class="con" id="right_shijiemoney">0</div></div>
            <div class="tuo"><div class="tit">结算扣罚款金额(元)</div><div class="con" id="right_shijiekoufafee">0</div></div>
            <div class="tuo"><div class="tit">收入合同结算净额(元)</div><div class="con" id="right_shijiejingfee">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">开票/回款</div>
            <div class="tuo"><div class="tit">项目开票金额(元)</div><div class="con" id="right_kai_money">0</div></div>
            <div class="tuo"><div class="tit">工程回款金额(元)</div><div class="con" id="right_shougonghuifee">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">待回款</div>
            <div class="tuo"><div class="tit">待回款按合同(元)</div><div class="con" id="right_daihuifee_anhe">0</div></div>
            <div class="tuo"><div class="tit">待回款按开票(元)</div><div class="con" id="right_daihuifee_ankai">0</div></div>
            <div class="tuo"><div class="tit">待回款按结算(元)</div><div class="con" id="right_daihuifee_anjie">0</div></div>
        </div>
    </div>
    <div><?php include '../public/shrrbox.php'?></div>
</div>
<script>
    var param_isdan = getQueryVariable('isdan') || 0;
    if(param_isdan > 0){
        $("#page-close").remove();
    }
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_contract_shi_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                $("#flowdingname").text(data.name);


                if(engininfo){
                    $("#tong_enginname").text(engininfo.name);
                }
                $("#tong_shihetype_name").text(data.shihetype_name);
                $("#tong_faer").text(data.faer);
                $("#tong_chenger_name").text(data.chenger_name);
                $("#tong_money").text(parseFormatNum(data.money));



                if(engininfo){
                    $("#right_money").text(parseFormatNum(data.money)).addClass('colorlan').click(function () {
                        openNavPage('查看收入合同信息','contract_shi/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_bumoney").text(parseFormatNum(data.bumoney)).addClass('colorlan').click(function () {
                        openNavPage('查看收入合同信息','contract_shi/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_shimoney").text(parseFormatNum(engininfo.shimoney)).addClass('colorlan').click(function () {
                        openNavPage('查看收入合同信息','contract_shi/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_visamoney").text(parseFormatNum(engininfo.visamoney)).addClass('colorlan').click(function () {
                        openNavPage('查看项目签证信息','engin_visa/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_chanmoney").text(parseFormatNum(engininfo.chanmoney)).addClass('colorlan').click(function () {
                        openNavPage('查看产值月报信息','engin_visa/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_shijiemoney").text(parseFormatNum(engininfo.shijiemoney)).addClass('colorlan').click(function () {
                        openNavPage('查看收入合同结算信息','contract_shi_jie/index.php?status=1&isreal=1&enginid='+engininfo.id);
                    });
                    $("#right_shijiekoufafee").text(parseFormatNum(engininfo.shijiekoufafee)).addClass('colorlan').click(function () {
                        openNavPage('查看收入合同结算信息','contract_shi_jie/index.php?status=1&isreal=1&enginid='+engininfo.id);
                    });
                    $("#right_shijiejingfee").text(parseFormatNum(engininfo.shijiejingfee)).addClass('colorlan').click(function () {
                        openNavPage('查看收入合同结算信息','contract_shi_jie/index.php?status=1&isreal=1&enginid='+engininfo.id);
                    });
                    $("#right_kai_money").text(parseFormatNum(engininfo.kai_money)).addClass('colorlan').click(function () {
                        openNavPage('查看项目开票信息','piao_kai/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_shougonghuifee").text(parseFormatNum(engininfo.shougonghuifee)).addClass('colorlan').click(function () {
                        openNavPage('查看项目收款信息','shou_xiang/index.php?status=1&feilei_option=xmsr_gchk&enginid='+engininfo.id);
                    });
                    $("#right_daihuifee_anhe").text(parseFormatNum(engininfo.daihuifee_anhe));
                    $("#right_daihuifee_ankai").text(parseFormatNum(engininfo.daihuifee_ankai));
                    $("#right_daihuifee_anjie").text(parseFormatNum(engininfo.daihuifee_anjie));
                }





                if(engininfo){
                    $("#enginid_name").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }


                $("#name").text(data.name);
                $("#number").text(data.number);
                $("#shihetype_name").text(data.shihetype_name);
                $("#year").text(data.year);
                $("#faer").text(data.faer);
                $("#chenger_name").text(data.chenger_name);
                $("#money").text(showChineseNumber(data.money));
                $("#noshuifee").text(showChineseNumber(data.noshuifee));
                $("#rate").text(data.rate);
                $("#startdt").text(data.startdt);
                $("#enddt").text(data.enddt);
                $("#duration").text(data.duration);
                $("#state").text(data.state);
                $("#henum").text(data.henum);
                $("#isyeji").text(data.isyeji);
                $("#qiandt").text(data.qiandt);
                $("#zhirate").text(data.zhirate);
                $("#zhifee").text(parseFormatNum(data.zhifee));
                $("#zhinum").text(data.zhinum);
                $("#zhidt").text(data.zhidt);
                $("#clause").text(data.clause);
                $("#explain").text(data.explain);

                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field:'',title:'流程状态',templet: function(d){
                                if(d.billid > 0){
                                    if(d.status == 0){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../contract_bu/show.php?id='+d.id+'\');">流程(审批中)</span>'
                                    }else if(d.status == 1){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../contract_bu/show.php?id='+d.id+'\');">流程(审批通过)</span>'
                                    }else{
                                        return '';
                                    }
                                }else{
                                    return '<td>手动</td>';
                                }
                            }}
                        ,{field:'',title:'补充合同名称',templet: function(d){
                                return '<span class="colorlan" onclick="show_contractbu('+d.id+')">'+d.name+'</span>';
                            }}
                        ,{field: 'number', title: '补充合同编号'}
                        ,{field: 'money', title: '合同金额含税(元)',align:'right',templet: function(d){return parseFormatNum(d.money);}}
                        ,{field: 'rate', title: '税率(%)'}
                        ,{field: 'noshuifee', title: '合同金额不含税(元)',align:'right',templet: function(d){return parseFormatNum(d.noshuifee);}}
                        ,{field: 'qiandt', title: '签订日期'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('contract_shi', param_id);
    });

    function show_contractbu(id) {
        openPage('../contract_bu/show.php?id='+id);
    }







</script>
</body>
</html>




